/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package miage.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Pepito
 */
@Entity
@Table(name = "client")
@XmlRootElement
@NamedQueries({
 @NamedQuery(name = "Client.findAll", query = "SELECT c FROM Client c"),
    @NamedQuery(name = "Client.findByIbanClient", query = "SELECT c FROM Client c WHERE c.ibanClient = :ibanClient"),
    @NamedQuery(name = "Client.findBySolde", query = "SELECT c FROM Client c WHERE c.solde = :solde"),
    @NamedQuery(name = "Client.findByNom", query = "SELECT c FROM Client c WHERE c.nom = :nom"),
    @NamedQuery(name = "Client.findByPrenom", query = "SELECT c FROM Client c WHERE c.prenom = :prenom"),
    @NamedQuery(name = "Client.findByPassword", query = "SELECT c FROM Client c WHERE c.password = :password"),
    @NamedQuery(name = "Client.findByLogin", query = "SELECT c FROM Client c WHERE c.login = :login"),
    @NamedQuery(name = "Client.findByEmail", query = "SELECT c FROM Client c WHERE c.email = :email"),
    @NamedQuery(name = "Client.findByAdresseClient", query = "SELECT c FROM Client c WHERE c.adresseClient = :adresseClient"),
    @NamedQuery(name = "Client.findByCodepostalClient", query = "SELECT c FROM Client c WHERE c.codepostalClient = :codepostalClient"),
    @NamedQuery(name = "Client.findByVilleClient", query = "SELECT c FROM Client c WHERE c.villeClient = :villeClient"),
    @NamedQuery(name = "Client.findByLoginPassword", query = "SELECT c FROM Client c WHERE c.login = :login and c.password = :password"),
    @NamedQuery(name = "Client.findByFlagClientAdmin", query = "SELECT c FROM Client c WHERE c.flagClientAdmin = :flagClientAdmin")})

public class Client implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 27)
    @Column(name = "iban_client")
    private String ibanClient;
    @Basic(optional = false)
    @NotNull
    @Column(name = "solde")
    private double solde;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "nom")
    private String nom;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "prenom")
    private String prenom;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "password")
    private String password;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "login")
    private String login;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "email")
    private String email;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "adresse_client")
    private String adresseClient;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "codepostal_client")
    private String codepostalClient;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "ville_client")
    private String villeClient;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "flag_client_admin")
    private String flagClientAdmin;

    public Client() {
    }

    public Client(String ibanClient) {
        this.ibanClient = ibanClient;
    }

    public Client(String login, String password) {
        this.login = login;
        this.password = password;
    }
    
    public Client(String ibanClient, double solde, String nom, String prenom, String password, String login, String email, String adresseClient, String codepostalClient, String villeClient, String flagClientAdmin) {
        this.ibanClient = ibanClient;
        this.solde = solde;
        this.nom = nom;
        this.prenom = prenom;
        this.password = password;
        this.login = login;
        this.email = email;
        this.adresseClient = adresseClient;
        this.codepostalClient = codepostalClient;
        this.villeClient = villeClient;
        this.flagClientAdmin = flagClientAdmin;
    }

    public String getIbanClient() {
        return ibanClient;
    }

    public void setIbanClient(String ibanClient) {
        this.ibanClient = ibanClient;
    }

    public double getSolde() {
        return solde;
    }

    public void setSolde(double solde) {
        this.solde = solde;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAdresseClient() {
        return adresseClient;
    }

    public void setAdresseClient(String adresseClient) {
        this.adresseClient = adresseClient;
    }

    public String getCodepostalClient() {
        return codepostalClient;
    }

    public void setCodepostalClient(String codepostalClient) {
        this.codepostalClient = codepostalClient;
    }

    public String getVilleClient() {
        return villeClient;
    }

    public void setVilleClient(String villeClient) {
        this.villeClient = villeClient;
    }

    public String getFlagClientAdmin() {
        return flagClientAdmin;
    }

    public void setFlagClientAdmin(String flagClientAdmin) {
        this.flagClientAdmin = flagClientAdmin;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ibanClient != null ? ibanClient.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Client)) {
            return false;
        }
        Client other = (Client) object;
        if ((this.ibanClient == null && other.ibanClient != null) || (this.ibanClient != null && !this.ibanClient.equals(other.ibanClient))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "miage.entities.Client[ ibanClient=" + ibanClient + " ]";
    }
    
}
